<h2 class="title">邮箱认证</h2>

<form action="/guider/subscribe" method="post" class="edit-mail fix">
    <img src="/resource/www/imgs/renz_jd1.png" class="img-icon">
    <label class="label fix">
        <span class="text">新邮箱地址</span>
        <input type="text" class="email" name="email" required placeholder="请输入你的邮箱地址">
    </label>

    <input type="submit" class="submit" value="确定" onclick="return submit_mail();">
    <input type="hidden" name="uid" value="<{$uid}>">
</form>
<script>
    $('.credit').addClass("active");
    $('.down-menu').eq(0).show();
    function submit_mail() {
    	var oEmail = $.trim($('.edit-mail').find("input[name='email']").val());
        var oEmailReg = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/;

        if (!oEmail) {
            layer.msg('请输入邮箱地址');
            return false;
        }
        if (!oEmailReg.test(oEmail)) {
            layer.msg('请输入正确的邮箱地址');
            return false;
        }
        $.post('/guider/valid_mail',{email:oEmail},function(o){
    	  if(o.status==0){
    		  $("form.edit-mail").submit();
    	  }else{
    		  layer.msg("该邮箱已被注册，请重新输入");
    	  }
        },'json');
        return false;
    }
</script>
